/* 
 * File:   Transaction.h
 * Author: wx
 *事务项的定义
 * Created on 2009年12月20日, 下午3:05
 */

#ifndef _TRANSACTION_H
#define	_TRANSACTION_H

#include <set>
#include <vector>
#include <cstring>
#include <sstream>
using namespace std;

class Transaction
{
private:
    set<int> transacset;

public:
    Transaction(set<int> newset)
    {
        transacset = newset;
    }

    Transaction(string s)
    {
        stringstream ss;
        ss << s;
        int i;
        while(ss>>i)
        {
            transacset.insert(i);
        }
    }

    vector<int> getFrequent(const vector<int> & frequentv)
    {
        vector<int> result;
        for(int i = 0;i < frequentv.size();i++)
        {
            if(transacset.find(frequentv[i]))
            {
                result.push_back(frequentv);
            }
        }
        return result;
    }

    set<int> getSet()
    {
        return transacset;
    }
};

#endif	/* _TRANSACTION_H */

